<?php 
$year=date("Y");
for($i=1;$i<=5;$i++)
{
	switch($i){
		case 1:$ps_title="năm";$link="index.php?key=year";break;
		case 2:$select="select * from dienvien limit 0,10";$link="index.php?key=act";$ps_title="diễn viên";$id="madienvien";$name="tendienvien";break;
		case 3:$select="select * from daodien limit 0,10";$link="index.php?key=dir";$id="madaodien";$name="tendaodien";$ps_title="đạo diễn";break;
		case 4:$select="select * from nhasx limit 0,10";$link="index.php?key=prod";$id="mansx";$name="tennsx";$ps_title="hãng";break;
		case 5:$select="select * from phim where linkanh is not null order by maphim DESC limit 0,10";$link="index.php?key=mostviewed";$id="maphim";$name="tenphim";$ps_title="luợt xem";break;
	}?>		
	<div class="box_link">
		<h3>Xem phim theo <?php echo $ps_title?></h3>
		<?php 
		if($i==1) 
			{
				echo "<ul class='box_link_first'>";
				for($j=$year;$j>=($year-9);)
				{
					if($j>($year-9))
					{?>
					<li><a class="" href="index.php?key=year&id=<?php echo $j?>">Phim <?php echo $j?></a></li>
                    <?php }
					else 
					{?>
					<li><a class="" href="index.php?key=year&id=<?php echo $j?>">Phim trứơc <?php echo $j+1?></a></li>
				<?php }
					$j--;
				}
			}
		else {
				echo "<ul>";
				$data = getdata($select);
				
				while($d=mysql_fetch_array($data))
				{?>
					<li><a class="" href="<?php echo $link?>&id=<?php echo $d[$id]?>"><?php echo $d[$name]?></a></li>
				<?php 
				}
		}?>
		</ul>
	</div>
<?php }?>
